package com.hbnu.thread;


//同时存钱问题
public class Account implements Runnable{
    private int account = 0;

    @Override
    public void run() {
        synchronized (this) {
            for (int i = 0; i < 3; i++) {
                account += 1000;
                System.out.println(Thread.currentThread().getName() + "存入1000元，当前余额：" + account);
            }
        }
    }
}
